package bitmapextension;

import org.anddev.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource;
import org.anddev.andengine.opengl.texture.source.BaseTextureAtlasSource;

import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;


//Texture Source that takes a Bitmap
public class BitmapTextureAtlasSource extends BaseTextureAtlasSource implements IBitmapTextureAtlasSource {
    
	private Bitmap mBitmap;
	
    public BitmapTextureAtlasSource(Bitmap pBitmap) {
    	super(0,0);
        this.mBitmap = pBitmap.copy(Bitmap.Config.ARGB_8888, false);
    }
 
    public int getWidth() {
        return mBitmap.getWidth();
    }
 
    public int getHeight() {
        return mBitmap.getHeight();
    }
 
    @Override
    public BitmapTextureAtlasSource clone() {
        return new BitmapTextureAtlasSource(Bitmap.createBitmap(mBitmap));
    }

	public Bitmap onLoadBitmap(Config pBitmapConfig) {
		return mBitmap;
	}
}

